package chances.training.lombok;

import java.io.UnsupportedEncodingException;
import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.SneakyThrows;
import lombok.ToString;

@RequiredArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@ToString(exclude = "createDate")
@EqualsAndHashCode
public class Operator {
	@NonNull
	@Setter
	@Getter
	private String name;
	
	private int age;
	private String email;
	private String fullName;
	private Date createDate = new Date();

	@SneakyThrows(UnsupportedEncodingException.class)
	public static String encode(@NonNull String name) {
		return new String(name.getBytes(), "UTF-8");
	}

	@SneakyThrows
	public static void throwException() {
		throw new Throwable();
	}

}
